package com.ruoyi.system.domain;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.data.annotation.Transient;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 自习室对象 room
 *
 * @author ...
 * @date 2022-03-17
 */
public class Room extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    private Integer id;

    /**
     * 房间名
     */
    @Excel(name = "房间名")
    private String name;

    /**
     * 房间类型
     */
    @Excel(name = "房间类型")
    private String type;

    /**
     * 房间图片
     */
    @Excel(name = "房间图片")
    private String picture;

    /**
     * 创建人
     */
    @Excel(name = "创建人")
    private Integer createUser;

    /**
     * 修改人
     */
    @Excel(name = "修改人")
    private Integer updateUser;

    /**
     * 是否已删除
     */
    @Excel(name = "是否已删除")
    private Integer isDeleted;

    /**
     * 座位规格
     */
    private String specifications;

    @Transient
    private Integer row;
    @Transient
    private Integer column;

    public Integer getRow() {
        return row;
    }

    public void setRow(Integer row) {
        this.row = row;
    }

    public Integer getColumn() {
        return column;
    }

    public void setColumn(Integer column) {
        this.column = column;
    }

    public String getSpecifications() {
        return specifications;
    }

    public void setSpecifications(String specifications) {
        this.specifications = specifications;
    }

    @Transient
    private Integer rows;

    public Integer getRows() {
        if (!"".equals(specifications) && specifications != null) {
            String[] split = specifications.split("-");
            rows = Integer.valueOf(split[0]);
        }
        return rows;
    }

    @Transient
    private Integer columns;

    public Integer getColumns() {
        if (!"".equals(specifications) && specifications != null) {
            String[] split = specifications.split("-");
            columns = Integer.valueOf(split[1]);
        }
        return columns;
    }

    @Transient
    private String pic;

    public String getPic() {
        if (picture != null) {
            pic = "http://localhost:8080" + picture;
        }
        return pic;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public String getPicture() {
        return picture;
    }

    public void setCreateUser(Integer createUser) {
        this.createUser = createUser;
    }

    public Integer getCreateUser() {
        return createUser;
    }

    public void setUpdateUser(Integer updateUser) {
        this.updateUser = updateUser;
    }

    public Integer getUpdateUser() {
        return updateUser;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("name", getName())
                .append("type", getType())
                .append("picture", getPicture())
                .append("createUser", getCreateUser())
                .append("createTime", getCreateTime())
                .append("updateUser", getUpdateUser())
                .append("updateTime", getUpdateTime())
                .append("isDeleted", getIsDeleted())
                .append("specifications", getSpecifications())
                .toString();
    }
}
